import QtQuick 2.0
import QtQuick.Controls 1.1
import "../FKWidget/"

FKWidget{
    id:netMenu
    relativeWidth: 0.25
    relativeHeight: 0.25

    signal startServerRequested(var port)
    signal joinServerRequested(var ip, var port)

    FKViewport{
        Item{
            anchors.fill: parent
            anchors.margins: 10
            Label{
                id: pl
                text: qsTr("Port:")
                anchors.left: parent.left
                anchors.top: parent.top
            }
            TextField{
                id:ti
                text:"3232"
                anchors.top:parent.top
                width: ip.width
                anchors.right: parent.right
            }
            Label{
                id:lip
                text:qsTr("IP-address:")
                anchors.left: parent.left
                anchors.top: ti.bottom
            }
            TextField{
                id:ip
                text:"127.0.0.1"
                anchors.left: lip.right
                anchors.top: ti.bottom
                anchors.right: parent.right
            }
            Button{
                id:ss
                text:qsTr("Start server")
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.bottom: jj.top
                onClicked: netMenu.startServerRequested(ti.text)
            }
            Button{
                id:jj
                text:qsTr("Join server")
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.bottom: cc.top
                onClicked: netMenu.joinServerRequested(ip.text,ti.text)
            }
            Button{
                id:cc
                text:qsTr("Cancel")
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                onClicked: netMenu.hide()
            }
        }
    }
}
